import "./index.scss";
import $ from "jquery";
import ProfileMgr from "../../data/ProfileMgr.js";
import LazyLoad from "../../modules/lazyLoad/lazyload.js";
import CreateWineType from "../../parts/inc/createWineType.js";
import IndexBanner from "../../parts/banner/index_banner.js";
import ListRender from "../../parts/listRender/index_listRender.js";
import IndexPagination from "../../parts/listRender/index_pagination.js";
import Cart from "../../parts/cart/cart";

$(function(){
    $('.web_head').load('./header.html'); 
    $('.footer').load('./footer.html');
    // 读取本地数据
    ProfileMgr.setUserName("");
    ProfileMgr.load();
    
    // 主页二级菜单
    new CreateWineType(".list_xuanwine ul");
    // banner
    new IndexBanner({
        pre: ".hb_top .pre",
        next: ".hb_top .next",
        ul: ".hb_top ul",
        inds: ".hb_top .btn"
    });
    /******************购物车**********************/ 
    let myCart = new Cart();
    /******************购物车**********************/ 
    // 懒加载
    let lazyLoad = new LazyLoad();
    // 列表渲染
    let listRender = new ListRender();
    listRender.init(".forth_hot ul", myCart.addCart.bind(myCart));
    // 分页
    new IndexPagination(36,function(data){
        listRender.setListData(data);
        lazyLoad.addListData(".cont_wineli .pic_tu .photos img");
    });

 });
